package com.spring.springboot.tree;

import java.util.Comparator;
import java.util.TreeMap;

/**
 * 项目名称: java_algorithm
 * @ClassName TestTree
 * @Description
 * @Author huipanxing huipanxing@chinasofti.com   @Date 2022/7/6 14:35
 */
public class TestTree {

    public static void main(String[] args) {

        TreeMap treeMap=new TreeMap(new Comparator() {
            @Override
            public int compare(Object o1, Object o2) {
//                System.out.println(Integer.parseInt(o1.toString())-Integer.parseInt(o2.toString())+"fffff");
//                return Integer.parseInt(o1.toString())-Integer.parseInt(o2.toString());
//                return o2.toString().compareTo(o1.toString());
                if (Integer.parseInt(o1.toString())>Integer.parseInt(o2.toString())){
                    return 1;
                }else {
                    return -1;
                }

            }
        });
        treeMap.put("1","1");
        treeMap.put("5","5");
        treeMap.put("4","4");
        treeMap.put("2","2");
        treeMap.put("3","3");
        System.out.println(treeMap);

//        System.out.println((int)'A');
//        System.out.println("1".hashCode());
//        System.out.println("2".hashCode());
    }

}
